<%@ page contentType="text/html;charset=UTF-8"%>
<!-- 引入标签库 -->
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib tagdir="/WEB-INF/tags/simpletable" prefix="simpletable"%>

<html>
<head>
	<title>系统用户维护</title>
	<!-- 包含公共资源 -->
	<%@ include file="/commons/meta.jsp" %>
	<%@ include file="/commons/meta-easyui.jsp" %>
	<%@ include file="/commons/meta-simpletable.jsp" %>
	<script type="text/javascript">
		function toAdd(){
			$("#queryForm").attr('action',"${ctx }/RightsUser/create.do");
			$("#queryForm").submit();
		}
	</script>
</head>
<body>
	<form id="queryForm" name="queryForm" action="${ctx }/RightsUser/list.do" method="post" style="display: inline;">
		<!-- 搜索区域 -->
		<div class="queryPanel" style="margin: 10px 0;">
			<fieldset>
				<legend>搜索</legend>
				<table>
					<tr>
						<td class="tdLabel">用户名</td>
						<td>
							<input value="${query.username}" id="username" name="username" maxlength="50" />
						</td>
						<td class="tdLabel">真实姓名</td>
						<td>
							<input value="${query.name}" id="name" name="name" maxlength="50" />
						</td>
						<td class="tdLabel">角色</td>
						<td>
							<select name="roleId">
								<option value="" >----请选择----</option>
								<c:forEach items="${requestScope.roleList}" var="role">
									<option value="${role.id }" <c:if test="${role.id eq query.roleId }">selected="selected"</c:if> > ${role.name }</option>
								</c:forEach>
							</select>
						</td>
					<tr>
						<td> 
						<a href="javascript:;" class="easyui-linkbutton"
							iconCls="icon-search" 
							onclick="getReferenceForm(this).action='${ctx}/RightsUser/list.do';getReferenceForm(this).submit();">搜索</a>
						</td>
					</tr>
				</table>
			</fieldset>
			<!-- 新增和删除按钮 -->			
			<div class="handleControl" style="margin: 10px 0;">
				<a href="javascript:;" onclick="toAdd();" class="easyui-linkbutton" iconCls="icon-add">新增</a>
				<a href="javascript:;" 
				onclick="batchDelete('${ctx}/RightsUser/delete.do','items','queryForm');" 
				class="easyui-linkbutton" iconCls="icon-remove" >删除</a>
				
			</div>
		</div>
		<!-- 搜索区域  结束-->
		
		<!-- 数据区域 -->
		<div class="gridTable">
			<table width="100%" border="0" cellspacing="0" class="gridBody">
				<!-- 表头 -->
				<thead>
					<tr>
						<th style="width: 1px;"></th>
						<th style="width: 1px;">
							<input type="checkbox" onclick="setAllCheckboxState('items',this.checked)">
						</th>
						<!-- 排序时为th增加sortColumn即可,new SimpleTable('sortColumns')会为tableHeader自动增加排序功能; -->
						<th sortColumn="username">用户名</th>
						<th sortColumn="name">真实姓名</th>
						<th sortColumn="phonenumber">电话号码</th>
						<th>状态</th>
						<th>角色</th>
						<th>操作</th>
					</tr>
				</thead>
				<!-- 表数据 -->
				<tbody>
					<c:forEach items="${requestScope.page.result }" varStatus="status" var="obj">
						<tr class="${status.count % 2 == 0 ? 'odd' : 'even'}">
							<!-- 序号 -->
							<td>${requestScope.page.thisPageFirstElementNumber + status.index}</td>
							<!-- 复选框 -->
							<td><input type="checkbox" name="items" value="${obj.id }"></td>
							<!-- 从第三列开始 是真正的数据 用el表达式取每个对象的每个属性 -->
							<td>${obj.username } &nbsp;</td>
							<td>${obj.name } &nbsp;</td>
							<td>${obj.phonenumber }&nbsp;</td>
							<td>${obj.status==1?'启用':'未启用'}&nbsp;</td>
							<td>${obj.rightsRole.name }&nbsp;</td>
							<td><a href="${ctx }/RightsUser/show.do?id=${obj.id}">查看</a><a href="${ctx }/RightsUser/edit.do?id=${obj.id}">更改</a></td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
			
			<p style="margin: 10px 0;">
			<!-- 分页区域 -->
			<simpletable:pageToolbar page="${requestScope.page}"></simpletable:pageToolbar>
			<!-- 分页区域 结束 -->
		</div>
		<!-- 数据区域  结束-->
	</form>
</body>
</html>

